package com.landleaf.smarthome.db.dao;

import com.landleaf.smarthome.db.manager.DbManager;
import com.landleaf.smarthome.model.DeviceModel;
import com.landleaf.smarthome.model.DeviceModelDao;

/**
 * When I wrote this, only God and I understood what I was doing
 * Now, God only knows
 * Created by 海航
 * 2020/10/12
 * 功能描述:
 */
public class DeviceDaoHelper extends BaseDaoHelper<DeviceModelDao, DeviceModel> {
    public DeviceDaoHelper() {
        super();
        dao= DbManager.getInstance().getDaoSession().getDeviceModelDao();
    }

    /**
     * 通过sn号获取设备
     * @param deviceSn
     * @return
     */
    public DeviceModel findDevice4Sn(String deviceSn) {
        return dao.queryBuilder().where(
                DeviceModelDao.Properties.DeviceSn.eq(deviceSn)
        ).unique();
    }

}
